﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	SecurableType.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System.Collections.Generic;

namespace Smart.Common.Security
{
	/// <summary>
	/// Securable type
	/// </summary>
	public abstract class SecurableType
	{
		/// <summary>
		/// Enter security context
		/// </summary>
		public abstract void EnterSecurityContext();

		/// <summary>
		/// Leave security context
		/// </summary>
		public abstract void LeaveSecurityContext();

		/// <summary>
		/// Checks whether security assignments inherited from parent securable object
		/// </summary>
		public abstract bool IsSecurityInherited(ISecurable securable);

		/// <summary>
		/// Make security inherit from parent securable object
		/// </summary>
		public abstract void InheritSecurity(ISecurable securable);

		/// <summary>
		/// Break security inheritance from parent securable object
		/// </summary>
		public abstract void BreakSecurityInheritance(ISecurable securable, bool copyAssignments);

		/// <summary>
		/// Ensure exact specified securable security assignments, except system security settings
		/// </summary>
		/// <returns>true, if security changed</returns>
		public abstract bool EnsureSecurityExact(ISecurable securable, ICollection<SecurityAssignment> assignments, bool currentScopeOnly);

		/// <summary>
		/// Ensure securable security assignments keeping existing, except system security settings
		/// </summary>
		/// <returns>true, if security changed</returns>
		public abstract bool EnsureSecurityInherit(ISecurable securable, ICollection<SecurityAssignment> assignments, bool currentScopeOnly);
	}
}